import { getAppVersion, getLanguage, getLastVersion, setLastVersion } from '@/util/storage'

let versionList

function init() {
  versionList = []
  versionList.push({
    language: 'zh',
    version: '12.03.15',
    contentList: [
      {
        title: '优化性能',
        content: '优化数据加载速度'
      },
      {
        title: '优化地图',
        content: '使用百度地图'
      }
    ]
  })
}

export function getVersionTip() {
  init()
  const lastVersion = getLastVersion()
  const appVersion = getAppVersion()
  if (appVersion !== lastVersion) {
    setLastVersion(appVersion)
    const language = getLanguage()
    for (const item of versionList) {
      console.log(language === item.language && appVersion === item.version)
      if (language === item.language && appVersion === item.version) {
        return item
      }
    }
  }
}
